package org.micode.demo.web.service;

import org.micode.common.domain.vo.KeyVO;
import org.micode.demo.biz.service.BizSysUserService;
import org.micode.demo.biz.vo.SysUserVO;
import org.micode.demo.db.domain.dto.SysUserDTO;
import org.micode.demo.db.service.DaoSysUserService;
import org.micode.demo.db.vo.ChangePwdVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户服务类
 * 
 * author: wutianbin
 */ 
@Service
@Slf4j
public class UserService {

    @Autowired 
    private DaoSysUserService daoSysUserService;

    @Autowired
    private BizSysUserService bizSysUserService;

    public SysUserVO info(KeyVO<Long> userKey) {
        SysUserDTO dto = daoSysUserService.get(userKey.getKey());
        if (null != dto) {
            return SysUserVO.fromDTO(dto);
        } else {
            return null;
        }
    }

    public Integer updateLoginPassword(ChangePwdVO pwdVO) {
        return bizSysUserService.updateUserPassword(pwdVO);
    }

}

